$(function() {
	
	var init = function() {
		this.serach();
	};
	
	var methods = {
		serach: function() {
			$.showloading();
			this.$http.post('score/class/list', {
				name: this.condition.name,
                page: {
                	pageNum: this.page.pageNum !== undefined ? this.page.pageNum : 1,
                    pageSize: this.page.pageSize !== undefined ? this.page.pageSize : 10
                }
			}).then(res => {
				var rsp = res.data;
                if ('0' !== rsp.err) {
                    bootbox.alert({
                        message: rsp.msg,
                        size: 'small'
                    });
                }
                
                this.items = rsp.rows;
                this.page = rsp.page;
            }).catch(() => {
                bootbox.alert({
                    message: '系统错误',
                    size: 'small'
                });
            }).finally(() => {
                $.hideloading();
            });
		},
		openTab: function (url, title) {
            window.parent.tabUtil.add(url, title, true);
        }
	};
	
	new Vue({
		el: '#app',
		data: {
			condition: {},
			items: [],
			page: {}
		},
		mounted: init,
        methods: methods
	});
});